import React, { Component, lazy, Suspense } from 'react';

const Demo = lazy(() => import('./demo'));
export default class Index extends Component {
  constructor(props) {
    super(props);
    this.state = {
      flag: false,
    };
  }

  componentDidMount() {
    setTimeout(() => {
      this.setState({
        flag: true,
      });
    }, 1000);
  }


  render() {
    return (
      <div>
        {this.state.flag ? <Suspense fallback={<h1>loading</h1>}>
          <Demo />
        </Suspense> : ''}

      </div>
    );
  }

}
